package net.atomtree.corrsepond.template;

import net.atomtree.corrsepond.mode.ApplicationMode;
import net.atomtree.corrsepond.execotor.ApplicationExecutor;

import java.util.Map;

/**
 * Created by czk on 2016/1/2.
 */
public class ApplicationURLTemplate implements URLTemplate{
    /**
     * this method can help you get right rest url
     * @param URLParam contain required rest url link properties such as host port appname and so on
     * @return  rest url
     */
    @Override
    public String analyse(Map<String, String> URLParam) throws Exception {
        int linkMode= new ApplicationMode().AnalyseMode(URLParam);
        if(linkMode==ApplicationMode.appNameMode)
             return ApplicationExecutor.appNameModeExecutor(URLParam);
        //if(linkMode==ApplicationMode.noAppNameMode)
        return ApplicationExecutor.noAppNameModeExecutor(URLParam);
    }

}
